/*-------------------------------------------------------------------------*/
/**
  @file		party_struct.h
  @author	Renaud Wanschoor
  @date	july 2004
  @version	$Revision: 2.2 $
  @brief	specific party structure used by pagridplot
  
*/
/*--------------------------------------------------------------------------*/

#ifndef PARTY_STRUCT_H
#define PARTY_STRUCT_H

struct partygraphdef {
  idxtype *gdata,*rdata;        /* Memory pools for graph data.
                                   This is where memory is allocated and used
                                   the rest of the fields in this structure */
  /* graph data */
  int nvtxs, nedges;		/* The # of vertices and edges in the graph */
  idxtype *xadj;		/* Pointers to the locally stored vertices */
  idxtype *vwgt;		/* Vertex weights */
  idxtype *vsize;		/* Vertex sizes for min-volume formulation */
  idxtype *adjncy;		/* Array that stores the adjacency lists of nvtxs */
  idxtype *adjwgt;		/* Array that stores the weights of the adjacency lists */

  idxtype *adjwgtsum;		/* The sum of the adjacency weight of each vertex */

  idxtype *cmap;

  /* refinement data */
  idxtype *where;

  int ncon;			/* The # of constrains */ 
  float *nvwgt;			/* Normalized vertex weights */

  struct partygraphdef *coarser, *finer;
};

typedef struct partygraphdef PartyGraphType;

/*************************************************************************
* The following data structure stores processors info
* 
**************************************************************************/
struct partyadjprolist{ /*Array storing information of a link in a processor graph*/
  int destination; /*processor that connects*/
  int weight;      /*weight of link connecting two processors*/
};

typedef struct partyadjprolist PartyAdjProList;

struct partyadjacentpro{ /*Array storing the adjacent processors list for each processor*/
  int count;	    /*number of adjacent processors*/
  PartyAdjProList *list; /*edge weight of the edge between it to each adjacent processor*/
};

typedef struct partyadjacentpro PartyAdjacentPro;


/*************************************************************************
* The following data structure stores grid information 
* 
**************************************************************************/
struct partygriddef {              /*computationtional grid information*/
  int npro;			/*Number of processors*/
  int virnpro;			/*Number of processors to simulate processor
				  weights */
  int nedges;			/*Number of links*/

  double **ratio;		/*Ratio (Tcomm/Tcomp) matrix*/
  
  int*    gdata;		/* pointer to allocated memory */
  int*    adjidx;		/* edge indexes */ 
  int*    adjncy;		/* edges (destination processor) */
  int*    adjwgt;		/* edges weight */
  double* exec;                 /* array of processors execution time */
  
  /**********************************/
  /* initial values of the ratio    */
  /**********************************/

  int    r_from;
  int    r_to;
  double r_val;

  /******************/
  /** -- REMOVE -- **/
  int **realnetcost;		/*Real Network Cost matrix*/
  int **netcost;		/*matrix that is used in refinement*/
  double *proratio;		/*Execution time Ratio for each processors*/
  double *proportion;		/*Processor weighting for each processors*/
  int    *intproportion;
  double *prospeed;             /* 1/proportion */
  int *penalty;			/*penalty weight for each processors*/
  PartyAdjacentPro* adjpro;	/*Processor Adjacent Info*/
  /** -- END REMOVE -- **/
  /**********************/

  int maxdegree;              /*average degree to processor graph*/
};

typedef struct partygriddef PartyGridType;

#endif
